package cn.zhukelili;

import java.beans.*;

/**
 * @author hhbeast
 * @create 2018-11-30-13:21
 **/
public class IntrospectorDemo {

    public static void main(String[] args) throws IntrospectionException {
        BeanInfo beanInfo = Introspector.getBeanInfo(SysUser.class);
        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
        MethodDescriptor[] methodDescriptors = beanInfo.getMethodDescriptors();
        BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
        for (PropertyDescriptor x:propertyDescriptors){
            System.out.println(x.getName());
            System.out.println(x.getReadMethod());
        }
        System.out.println("-----------------------");
        for (MethodDescriptor y:methodDescriptors){
            System.out.println(y.getName());
        }
    }
}

/**
        作者：不学无数的程序员
        链接：https://juejin.im/post/5b8d0590e51d4538e6334e59
        来源：掘金
        著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。
 */